home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Online
/
LineShare 3.3.1
/
LineShare Scripts
/
Zoom Fax1&ARA&Data
< prev
next >
Wrap
Text File
|
1994-10-06
|
8KB
|
383 lines
! Version 3.0
!
!$ Use this script with Rockwell-based (Zoom, Hayes Optima, etc)
!$ data/fax modems.
!$ Supports: fax, ARA and regular data incoming calls.
!
!$ Make sure that *Class 1* fax software is installed
!
!$ A cable for hardware handshaking is required
^2 Speaker On: = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
^3 Speaker Volume: = Enum("Low"="1","Medium"="2","High"="3") "2"
^4 Answer On: = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
^5 Port Speed: = Enum("9600","19200","38400","57600") "19200"
^6 Handshake wires: = Bool("Both"="&D0","CTS only"="&D2") "&D2"
! ------------------------------------------
! Resetting the modem:
! ------------------------------------------
@Hangup
SetTries 2
Flush
HsReset 0,0,17,19,0,0
DtrSet
!
! Try to catch the "OK" answer, use the Escape seq and DTR transitions
! to enter the command mode
!
@Label 1
matchclr
matchstr 1 2 "OK\r\n"
write "ATH0&F\r"
matchread 20
ChrDelay 1
Write "+++"
ChrDelay 0
DtrClear
SBreak
DtrSet
!
DecTries
IfTries 0 1
!
! OSErr -6019 "Modem error - the modem is not responding"
!
exit -6019
@Label 2
write "AT+FCLASS=0\r"
Jsr 100
write "AT+FAE=0\r"
Jsr 100
exit 0
! ------------------------------------------
! Receiving incoming calls
! ------------------------------------------
@ANSWER
!
! Set the modem preferred speed first
!
SerReset Val("^5"),0,8,1
Jsr 80
@Label 10
!
! Set the common options
Jsr 70
!
! Set the communication options:
! • &Q6: Normal connection (for ARA)
! • &K4: SW flow control (for fax)
! • W1: report connection speed
!
Write "AT&Q6&K4W1\r"
Jsr 100
!
! Set Fax mode
!
Write "AT+FCLASS=1\r"
Jsr 100
Write "AT+FAE=1\r"
Jsr 100
!
! It's for Rockwell ONLY! Set FCLASS to 0 again - otherwise,
! it cannot accept data calls
!
Write "AT+FCLASS=0\r"
Jsr 100
!
! Tell the modem to determine the type of the incoming call
! Fetch the tube after ^4 rings
!
Write "ATS0=^4V0\r"
Jsr 110
!
! Everything is ready - let's sit and wait for a call
! We'll wait for 2 minutes, then reinitiate the modem
!
Note "Waiting for a fax/ARA/data call…"
MatchClr
MatchStr 01 19 "33\r"
MatchStr 02 14 "35\r"
matchstr 10 18 "2\r"
matchstr 11 57 "1\r"
matchstr 12 13 "3\r"
matchstr 13 13 "8\r"
matchstr 14 13 "7\r"
@Label 12
Matchread 1200
@Label 13
Note "Tuning again…"
Write "ATV1\r"
Jsr 100
Jump 10
@Label 14
Note "Data Call…"
Write "AT&K3W1V1O0\r"
MatchClr
MatchStr 01 16 "CARRIER ^$\r\n"
MatchStr 02 20 "CONNECT ^$\r\n"
MatchStr 03 10 "NO ANSWER\r\n"
MatchStr 04 10 "NO CARRIER\r\n"
@Label 15
MatchRead 20
Exit -6019
@Label 16
SetVar B "^$"
Jump 15
@Label 18
Note "Ring…"
Jump 12
@Label 19
SetSpeed 19200
Note "Fax tones detected…"
Jump 12
!
! Data connection has been established (we read "CONNECT")
! Put the "CONNECT" back to the buffer and attach the "Data" subPort
! if it was an incoming call, put the "RING" before the "CONNECT"
!
@Label 20
IfOpen "Data" 21
Jump 30
@Label 21
IfOpen "ARA" 22
Jump 35
@Label 22
Note "Waiting for an ARA frame"
MatchClr
MatchStr 1 23 "^$\r"
MatchStr 2 28 "\08\01\03\14\04\03\00\08\250\16\03"
MatchStr 3 29 "\01\27\02\29\01\02\01\06"
MatchRead 60
Jump 24
@Label 23
QueueInput "^$\r"
@Label 24
Note "Non-ARA call"
Jump 35
@Label 28
Note "ARA 1.0 call"
Jump 30
@Label 29
Note "ARA 2.0 call"
Jump 30
@Label 30
QueueInput "\r\nCARRIER ^B\r\n"
QueueInput "\r\nRING\r\n"
Attach "ARA" (DTR)
@Label 35
GetSReg C "DATA" 4
QueueInput "\r^CCONNECT ^B\r^C"
ifOriginate 36
QueueInput "\r^CRING\r^C"
@Label 36
Attach "Data" (DTR,Escape,Break)
! ------------------------------------------
! Originating a call through the "ARA" subport
! ------------------------------------------
@ORIGINATE "ARA"
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • &Q6:Normal connection (no compression, correction - for ARA)
! • &K3: HW Handshake
! • S7: time-out (90 sec) for long-distance call (if you use them)
! • W1: report connection rate
!
Write "AT&Q6&K3S7=90W1\r"
Jsr 100
!
! Emit the ARA script commands ("Xnn")
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 55 "\r\nCARRIER "
MatchRead 1000
Write "\r"
Exit -6019
@Label 55
QueueInput "\r\nCARRIER "
Attach "ARA" (DTR)
! ------------------------------------------
! Originating a call through the "DATA" subport
! ------------------------------------------
@ORIGINATE "Data"
SerReset Val("^5"),0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Data mode:
! • \N3: Auto-reliable
! • &K3: HW Handshake
! • S7: time-out (90 sec) for long-distance call (if you use them)
!
Write "AT&K3S7=90\r"
Jsr 100
!
! Emit the Data commands
Jsr 60
!
! Prepare to receive all error result codes, dial the number
!
Jsr 90
MatchStr 1 56 "\r\nCONNECT "
MatchRead 1000
Write "\r"
Exit -6019
@Label 56
QueueInput "\r\nCONNECT "
Attach "Data" (DTR,Escape,Break)
! ------------------------------------------
! Originating a call through the "Fax" subPort
! ------------------------------------------
@ORIGINATE "Fax"
!
! Set the "Fax" speed
!
SerReset 19200,0,8,1
Jsr 80
!
! Set the common options
!
Jsr 70
!
! Set the Fax mode
! &K4: Xon/Xoff handshake
! &S0: DSR always on (see above)
!
Write "AT&S0&K4+FCLASS=1\r"
Jsr 100
!
! Now emit all commands that the application has sent to that port,
! except "FCLASS", etc
!
EmitClear "+FCLASS","V","E"
Jsr 60
Write "ATV0\r"
Jsr 110
!
! Prepare to receive all error result codes, dial the number
!
MatchClr
MatchStr 01 57 "1\r"
MatchStr 13 93 "3\r"
MatchStr 14 94 "8\r"
MatchStr 15 92 "7\r"
Write "ATD^1\r"
HsReset *
MatchRead 900
Write "\r"
Exit -6019
!
! Fax connection has been established (we read "FAX")
! Put the +FCON back to the buffer,
! if it was an incoming call, put the "RING" before the "+FCON"
! Attach the "Fax" subPort
!
@Label 57
QueueInput "1\r"
SetSpeed 19200
ifOriginate 59
!@Label 58
QueueInput "2\r2\r"
@Label 59
Attach "Fax" (Reset(2400),IdleLimit=30)
!
! This section emits all modem commands sent from the client application
! For each set of commands the "OK" answer is awaited
!
@Label 60
EmitStart
@Label 61
EmitCommand 62
Jsr 100
Jump 61
@Label 62
return
!
! This section initiates the modem before ANSWER and ORIGINATEs:
! extended responses + connect at the highest rate + speaker control +
! reset on Dtr drop + DCD valid
! Verbal responses mode, no echo
!
@Label 70
Write "ATX4N1M^2L^3^6&C1V1E0\r"
Jsr 100
return
!
! This section syncronize the modem after the serial port speed switching
!
@Label 80
ChrDelay 1
Write "AT\r"
ChrDelay 0
Jsr 100
return
!
! Prepare to receive error result codes, send the dialing command and
! set the user's handshake mode
!
@Label 90
MatchClr
MatchStr 2 91 "NO DIALTONE\r\n"
MatchStr 3 92 "BUSY\r\n"
MatchStr 4 93 "NO CARRIER\r\n"
MatchStr 5 94 "NO ANSWER\r\n"
Write "ATD^1\r"
HsReset *
return
@Label 91
exit -6020
@Label 92
exit -6022
@Label 93
exit -6021
@Label 94
exit -6023
!
! Processing the AT command:
! OK -> proceed
! ERROR or TimeOut ->exit -6019
! It can be called AFTER the "Write" command, since LineShare buffers input
!
@Label 100
MatchClr
MatchStr 1 103 "\r\nOK\r\n"
MatchStr 2 102 "\r\nERROR\r\n"
@Label 101
MatchRead 20
@Label 102
Exit -6019
@Label 103
return
@Label 110
MatchClr
MatchStr 1 103 "0\r"
MatchStr 2 102 "4\r"
Jump 101